﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Mozlite.Components;
using Mozlite.WebUI.Mvc4.Configuration;

namespace Mozlite.WebUI.Mvc4
{
    /// <summary>
    /// 全局应用程序。
    /// </summary>
    public class MvcApplication : System.Web.HttpApplication
    {
        /// <summary>
        /// 应用程序启动时执行方法。
        /// </summary>
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new ThemeBuildManagerViewEngine());
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

#if DEBUG
            ContentModules.Register();
#endif
        }

        /// <summary>
        /// 验证开启。
        /// </summary>
        protected void Application_AuthorizeRequest()
        {
            Users.CheckedUniqueeLogin();
        }
    }
}
